package org.sxp.common.config;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;

/**
 * @author shenxingping
 * @date 2022/01/03
 */
public class ListJSONHandler extends FastjsonTypeHandler {

    private final Class<? extends Object> type;

    public ListJSONHandler(Class<?> type) {
        super(type);
        this.type = type;
    }

    @Override
    protected Object parse(String json) {
        return JSON.parseObject(json, this.type);
    }

    @Override
    protected String toJson(Object obj) {
        return super.toJson(obj);
    }
}
